<?php
    if(isset($_POST['button'])){
        switch($_POST['color']){
            case '1':
                $color='#ff0000';
                break;
            case '2':
                $color='#009900';
                break;
            case '3':
                $color='#0000ff';
                break;
            default:
            $colo='#0000'  ;  
        }
        echo "
         <script>
        window.onload=function(){
            document.getElementById('shi').style.color='$color'
        }
        </script>"
    }
    
?>
<!-- <script>
window.onload=function(){
    document.getElementById('shi').sstyle.color=''
}
</script> -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id='shi' class=''>
    锄禾日当午，
    汗滴禾下土。
    谁知盘中餐，
    粒粒皆辛苦。
    </div>
    <form action="" method='post'>
    
    <select name="color" > 
    <option value="">请选择颜色</option> 
    <option value="">红色</option> 
    <option value="">蓝色</option> 
    <option value="">绿色</option> 
     </select> 
     <input type="submit" value="修改颜色" name='button'>
     </form>
</body>
</html>